package demo.classuse;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/19-07-19-11:42
 * @Description：demo.classuse 类和对象
 */
//抽象类
     //属性和方法
public class Student {
    //定义属性/字段
    private String name;   //姓名
    private int  sno;      //学号

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", sno=" + sno +
                ", age=" + age +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSno() {
        return sno;
    }

    public void setSno(int sno) {
        this.sno = sno;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(String name, int sno, int age) {
        this.name = name;
        this.sno = sno;
        this.age = age;
    }

    public Student() {
        this("hjy",2019,18);
    }

    private int age;       //年龄

    //定义方法
    //修饰符 返回值 方法名字([参数]){}
    public void sayHello(){
        System.out.println("hello,name = " + name);
    }


    public static void test(String s){
        s = "world";
        System.out.println(s);
    }
}
